.class public Lcom/instagram/android/creation/widget/AngleRulerView;
.super Landroid/view/View;
.source "AngleRulerView.java"


# instance fields
.field private a:Landroid/graphics/Paint;

.field private b:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 28
    invoke-direct {p0, p1}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    .line 29
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->a()V

    .line 30
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 33
    invoke-direct {p0, p1, p2}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 34
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->a()V

    .line 35
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 38
    invoke-direct {p0, p1, p2, p3}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 39
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->a()V

    .line 40
    return-void
.end method


# virtual methods
.method public a()V
    .locals 3

    .prologue
    .line 52
    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->a:Landroid/graphics/Paint;

    .line 53
    iget-object v0, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->a:Landroid/graphics/Paint;

    const/4 v1, -0x1

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 54
    iget-object v0, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->a:Landroid/graphics/Paint;

    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/facebook/au;->straighten_ruler_angle_text_size:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getDimension(I)F

    move-result v1

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 55
    iget-object v0, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->a:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Typeface;->DEFAULT_BOLD:Landroid/graphics/Typeface;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    .line 56
    iget-object v0, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->a:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Align;->CENTER:Landroid/graphics/Paint$Align;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 57
    return-void
.end method

.method public getMaximumAngle()F
    .locals 1

    .prologue
    .line 79
    iget v0, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->b:I

    div-int/lit8 v0, v0, 0x2

    mul-int/lit8 v0, v0, 0x5

    int-to-float v0, v0

    return v0
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 7
    .parameter "canvas"

    .prologue
    .line 61
    invoke-super {p0, p1}, Landroid/view/View;->onDraw(Landroid/graphics/Canvas;)V

    .line 62
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v1

    .line 63
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getLeft()I

    move-result v0

    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getWidth()I

    move-result v2

    mul-int/lit8 v3, v1, 0xc

    sub-int/2addr v2, v3

    div-int/lit8 v2, v2, 0x2

    add-int/2addr v0, v2

    .line 64
    int-to-double v2, v0

    int-to-double v4, v1

    div-double/2addr v2, v4

    invoke-static {v2, v3}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v2

    double-to-int v0, v2

    mul-int v2, v0, v1

    .line 66
    const/4 v0, 0x0

    :goto_0
    const/16 v3, 0xc

    if-gt v0, v3, :cond_1

    .line 67
    mul-int/lit8 v3, v0, 0x5

    add-int/lit8 v3, v3, -0x1e

    .line 69
    invoke-static {v3}, Ljava/lang/Math;->abs(I)I

    move-result v4

    int-to-float v4, v4

    const/high16 v5, 0x41f0

    cmpg-float v4, v4, v5

    if-gtz v4, :cond_0

    .line 70
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const/16 v4, 0xb0

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 71
    mul-int v4, v0, v1

    add-int/2addr v4, v2

    .line 72
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getTop()I

    move-result v5

    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getBottom()I

    move-result v6

    add-int/2addr v5, v6

    div-int/lit8 v5, v5, 0x2

    .line 73
    int-to-float v4, v4

    int-to-float v5, v5

    iget-object v6, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->a:Landroid/graphics/Paint;

    invoke-virtual {p1, v3, v4, v5, v6}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 66
    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 76
    :cond_1
    return-void
.end method

.method public onMeasure(II)V
    .locals 3
    .parameter "widthMeasureSpec"
    .parameter "heightMeasureSpec"

    .prologue
    .line 44
    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v0

    .line 45
    invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I

    move-result v1

    .line 46
    mul-int/lit8 v2, v0, 0xc

    add-int/2addr v1, v2

    .line 47
    div-int v2, v1, v0

    div-int/2addr v1, v0

    rem-int/lit8 v1, v1, 0x2

    add-int/2addr v1, v2

    iput v1, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->b:I

    .line 48
    iget v1, p0, Lcom/instagram/android/creation/widget/AngleRulerView;->b:I

    mul-int/2addr v0, v1

    invoke-virtual {p0}, Lcom/instagram/android/creation/widget/AngleRulerView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v1

    invoke-virtual {v1}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v1

    invoke-virtual {p0, v0, v1}, Lcom/instagram/android/creation/widget/AngleRulerView;->setMeasuredDimension(II)V

    .line 49
    return-void
.end method
